package com.iwhalecloud.bss.kite.cucc.service.attr.linkhandler;

import com.iwhalecloud.bss.kite.common.constant.KeyConsts;
import com.iwhalecloud.bss.kite.cucc.service.attr.handler.CircuitTypeHandler;
import com.iwhalecloud.bss.kite.listener.handler.attr.annotation.AttrHandler;
import com.iwhalecloud.bss.kite.listener.handler.attr.impl.AbstractAttrLinkageHandler;
import com.iwhalecloud.bss.kite.manager.inst.KiteAttr;
import com.iwhalecloud.bss.kite.manager.inst.KiteInst;
import com.iwhalecloud.bss.kite.service.attr.AttrData;
import org.springframework.stereotype.Service;

/**
 * @author xueyf
 * @Description
 * @Date 2021/5/26 14:47
 */
@Service
@AttrHandler(CircuitTypeHandler.class)
public class CircuitUsesDisplayLinkHandler extends AbstractAttrLinkageHandler<AttrData> {
    /**
     * 以太网类型
     */
    private static final String ETHERNET= "110007436";
    /**
     * 是否划分VLAN
     */
    private static final String VLAN_PARTITION_FLAG = "2_0000033";
    @Override
    public void handle(KiteAttr kiteAttr, KiteInst kiteInst, AttrData attrData) {
        if(ETHERNET.equals(kiteAttr.getValue())){
            KiteAttr vlanPartitionFlagAttr = kiteInst.getAttr(VLAN_PARTITION_FLAG);
            vlanPartitionFlagAttr.setShowType(KeyConsts.PROD_ATTR_SHOW_TYPE_D);

        }else {
            KiteAttr vlanPartitionFlagAttr = kiteInst.getAttr(VLAN_PARTITION_FLAG);
            vlanPartitionFlagAttr.setShowType(KeyConsts.PROD_ATTR_SHOW_TYPE_E);
            vlanPartitionFlagAttr.setValue(null);
        }
    }

    @Override
    public void handleStyle(KiteAttr kiteAttr, KiteInst kiteInst, AttrData attrData) {

    }
}
